package com.leilei.greendao.greendao;

import java.util.Map;

import org.greenrobot.greendao.AbstractDao;
import org.greenrobot.greendao.AbstractDaoSession;
import org.greenrobot.greendao.database.Database;
import org.greenrobot.greendao.identityscope.IdentityScopeType;
import org.greenrobot.greendao.internal.DaoConfig;

import com.leilei.greendao.mode.Person;
import com.leilei.greendao.mode.Son;

import com.leilei.greendao.greendao.PersonDao;
import com.leilei.greendao.greendao.SonDao;

// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.

/**
 * {@inheritDoc}
 * 
 * @see org.greenrobot.greendao.AbstractDaoSession
 */
public class DaoSession extends AbstractDaoSession {

    private final DaoConfig personDaoConfig;
    private final DaoConfig sonDaoConfig;

    private final PersonDao personDao;
    private final SonDao sonDao;

    public DaoSession(Database db, IdentityScopeType type, Map<Class<? extends AbstractDao<?, ?>>, DaoConfig>
            daoConfigMap) {
        super(db);

        personDaoConfig = daoConfigMap.get(PersonDao.class).clone();
        personDaoConfig.initIdentityScope(type);

        sonDaoConfig = daoConfigMap.get(SonDao.class).clone();
        sonDaoConfig.initIdentityScope(type);

        personDao = new PersonDao(personDaoConfig, this);
        sonDao = new SonDao(sonDaoConfig, this);

        registerDao(Person.class, personDao);
        registerDao(Son.class, sonDao);
    }
    
    public void clear() {
        personDaoConfig.clearIdentityScope();
        sonDaoConfig.clearIdentityScope();
    }

    public PersonDao getPersonDao() {
        return personDao;
    }

    public SonDao getSonDao() {
        return sonDao;
    }

}
